﻿#ifndef CUSTOM_UNLIT_PASS_INCLUDED
#define CUSTOM_UNLIT_PASS_INCLUDED



struct Attributes{
    float3 positionOS : POSITION;
	float2 baseUV : TEXCOORD0;
    UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct Varyings{
    float4 positionCS :SV_POSITION;    
	float2 baseUV : VAR_BASE_UV;
    UNITY_VERTEX_INPUT_INSTANCE_ID
};

 Varyings  UnlitPassVertex(Attributes input) 
 {
    Varyings output;
    UNITY_SETUP_INSTANCE_ID(input);
    UNITY_TRANSFER_INSTANCE_ID(input,output);
    float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
    output.positionCS = TransformWorldToHClip(positionWS);  
	output.baseUV = TransformBaseUV(input.baseUV);
    return output;
 }
 
 float4  UnlitPassFragment(Varyings input) : sv_target
 { 
    InputConfig config = GetInputConfig(input.baseUV);

    UNITY_SETUP_INSTANCE_ID(input);    
    float4 base =  GetBase(config);
#if defined(_CLIPPING)    
    clip(base.a - GetCutoff(config));
#endif
    	return base;
 }

#endif
